<?php
	include("confirmationAlert.php");
?>

<div id="edit-event-dlg" style="font-size: 62.5%; display: none;" title="Edycja rezerwacji">
	<form id="edit-event-form" method="post" action="<?php echo Yii::app()->request->baseUrl; ?>/index.php/calendar/deleteStudentReservation">
		<p class="validateTips"></p>
		<input id="id" type="hidden" name="id" class="id" >
		<input id="eventname" class="eventname" name="name" disabled="disabled">
		<label for="stationname">Stanowisko: </label>
		<input id="stationname" class="stationname" name="stationname" disabled="disabled">
		<label for="startdate">Początek zajęć: </label>
		<input disabled="disabled" class="startdate" id="startdate" name="startdate">
		<label for="enddate" id="enddate">Koniec zajęć: </label>
		<input disabled="disabled" class="enddate" name="enddate">
		
		<label for="occupied">Zapisanych: </label>
		<input id="occupied" class="occupied" name="occupied" disabled="disabled">
		<label for="limit">Limit: </label>
		<input id="limit" class="limit" name="limit" disabled="disabled"><br>
	</form>
</div>

<script>

function readStations(data) {
	var reserv = data.reserv;
	
	$("#new-event-station").html('');
	
	if(reserv.length!=0)
	{
		$("input[name='name']").val('Zapisany!');
	}
	else
	{
		$("input[name='name']").val('Nie zapisany');
	}
}


$(function() {
	
	$( "#edit-event-dlg" ).dialog({
		autoOpen: false,
		height: 510,
		width: 350,
		modal: true,
		resizable: false,
		buttons : {
			"Wypisz":function(){
				$.confirm({
		            'title'		: deleteAlert.title_begin + deleteAlert.topic_reservation + deleteAlert.title_end,
		            'message'	: deleteAlert.message_student,
		            'buttons'	: {
		                'Tak'	: {
		                    'class'	: 'blue',
		                    'action': function(){
								$.post(
										'<?php echo Yii::app()->request->baseUrl; ?>/index.php/calendar/deleteStudentReservation',
										$("#edit-event-form").serialize()).done(
		            					function(data) {
		            						$('#calendar').fullCalendar( 'refetchEvents' );
		            					});
								$( "#edit-event-dlg" ).dialog( "close" );
			               	}
			          	},
			          	'Nie'	: {
		                    'class'	: 'gray',
		                    'action': function(){
		                    	$( "#edit-event-dlg" ).dialog( "close" );
			                    }	// Nothing to do in this case. You can as well omit the action property.
		                }
		            }
		        });
			},
			"Anuluj": function() {
				$( this ).dialog( "close" );
			}
		},
		open: function() {
			
		}
	});
});
</script>